#include <50func.h>
int main(int argc, char *argv[])
{
    // ./2_read file1
    ARGS_CHECK(argc,2);
    int fd = open(argv[1],O_RDONLY);
    ERROR_CHECK(fd,-1,"open");
    char buf[4] = {0};
    ssize_t sret = read(fd,buf,3);
    printf("sret = %ld, buf = %s\n", sret, buf);
    sret = read(fd,buf,3);
    printf("sret = %ld, buf = %s\n", sret, buf);
    sret = read(fd,buf,3);
    printf("sret = %ld, buf = %s\n", sret, buf);
    memset(buf,0,4);//避免误导，读之前需要清空
    sret = read(fd,buf,3);
    printf("sret = %ld, buf = %s\n", sret, buf);
    memset(buf,0,4);//
    sret = read(fd,buf,3);
    printf("sret = %ld, buf = %s\n", sret, buf);
    return 0;
}

